<template>
	<view class="more" @click="statusClick" >
		<view v-if="status == 'more'">
			{{moreText ? moreText : data[status]}}
		</view>
		<view v-if="status == 'loading'">
			<text class="iconfont icon-load" ></text>
			{{data[status]}}
		</view>
		<view v-if="status == 'nomore'">
			{{data[status]}}
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			status:{
				type:String,
				default: 'more'
			},
			moreText:{ // 上拉加载更多文本
				type:String,
				default:''
			}
		},
		data(){
			return{
				data:{
					more: '上拉加载更多',
					loading: '正在加载...',
					nomore: '没有更多数据了'
				}
			}
		},
		methods:{
			statusClick(){
				this.$emit("loadClick")
			}
		}
	}
</script>

<style scoped>
	.more{
		font-size: 0.8rem;
		padding: 10px;
		text-align: center;
		color: #777777;
	}
	.icon-load{
		vertical-align: middle;
		margin-right: 10px;
		display: inline-block;
		animation: rotate 1s linear infinite;
	}
	@keyframes rotate{
		from{
			transform: rotate(0deg);
		}
		to{
			transform: rotate(360deg);
		}
	}
</style>
